Performs a batched optimistic update.
Syntax
object.BatchUpdate (SingleRow, Force)
The BatchUpdate method syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
SingleRow | A Boolean value that is True if the update is done only for the current row, or False if the update applies to all rows in the batch. Default is False. |
Force | A Boolean value that is True if the row or batch of rows will overwrite existing rows in the database regardless if they cause collisions or not. Default is False. |
Remarks
This method performs a batch optimistic update operation. When using batch optimistic concurrency, it is necessary to call this method to actually send the changes back to the server.
Batch updates are used whenever you open a connection using the Client Batch cursor library (rdUseClientBatch). In this case, each time you use the Update or UpdateRow methods, the local rdoResultset is updated, but the base database tables are not changed. The BatchUpdate method is used to update the base database table(s) with any information changed since the rdoResultset was last created or synchronized with the BatchUpdate command.
The BatchUpdate method updates the BatchCollisionRows property to include a bookmark for each row that failed to update – collided with an existing row that has data more current than the rdoResultset object as it existed when first read. The BatchCollisionCount property indicates how many collisions occurred during the batch update process.
If you use the CancelBatch method, the changes saved to the local rdoResultset object are discarded. When you use the CancelUpdate method, only the current row’s changes are rolled back to the state prior to execution of the last Update method.
The SingleRow parameter can be used in conjunction with the Force parameter to force the client’s version of the data back into the database, even if collisions have occurred. The SingleRow parameter will tell RDO to only send the current row back to the server and not the entire batch, and the Force parameter will tell RDO to force the data in, and not use the normal optimistic concurrency detection.
Setting both the SingleRow and Force parameters to True overlays a single database row with the current updated rdoResultset row. This is useful when processing collision rows and you want to force your local version of the data to be saved regardless of the current database row setting.
Setting SingleRow to False and Force to True will cause all rows that are dirty to be forced into the database, which is useful as a shorthand way of forcing everything in (the last-one-in-wins scenario).
Setting SingleRow to True and Force to False will cause just the current row to go through the optimistic concurrency update, which is useful when you only want to update the current row, not the entire batch.